#include <iostream>
#include <vector>
using namespace std;

class Solution
{
public:
    bool isZeroArray(vector<int> &nums, vector<vector<int>> &queries)
    {
        vector<int> temp(nums.size(), 0);
        for (auto q : queries)
        {
            int left = q[0], right = q[1];
            temp[left] -= 1;
            if (right + 1 < temp.size())
                temp[right + 1] += 1;
        }
        for (int i = 1; i < temp.size(); i++)
        {
            temp[i] = temp[i] + temp[i - 1];
        }
        for (int i = 0; i < nums.size(); i++)
        {
            if (nums[i] + temp[i] > 0)
                return false;
        }
        return true;
    }
};

int main()
{
    cout << "Code3355" << endl;
    Solution s;
    vector<int> nums = {1, 0, 1};
    vector<vector<int>> queries = {{0, 2}};
    cout << s.isZeroArray(nums, queries) << endl;
    return 0;
}